import Vue from 'vue'
import Vuex from 'vuex'
// import { getItem, setItem } from '@/utils/storage.js'
import { WaitingNumber } from '@/api/user'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)
// const TOKEN_KEY = 'TOUTIAO_USER'
export default new Vuex.Store({
  state: {

    userinfo: '',
    waitPeopleList: [], // 等待人的列表
    waitPeopleName: [] // 等待人的姓名
  },
  getters: {
  },
  mutations: {
    setUser (state, data) {
      state.userinfo = data
    },
    setWaitName (state, name) {
      state.waitPeopleName = name
    },
    clearWaitName (state, clear) {
      state.waitPeopleName = clear
    },
    setwaitPeopleList (state, Peoplelist) {
      state.waitPeopleList = Peoplelist
    },
    clearwaitPeopleList (state, clear) {
      state.waitPeopleList = clear
    }

  },

  actions: {
    // async getWaitingNumber () {
    //   const { data: { data: res } } = await WaitingNumber()
    //   this.$store.commit('setwaitPeopleList', res)
    //   console.log(this.waitPeopleList)
    // }
  },
  modules: {
  },
  plugins: [
    createPersistedState() // 注入持久化插件
  ]
})
